<template>
  <div v-if="message"
       style="color:red;">{{message}}</div>
  <div v-else>无</div>
</template>
<script>
export default {
  name: "Errors",
  props: {
    row: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {};
  },
  computed: {
    message () {
      let errArr = [];
      this.row?.errors.length && this.row.errors?.forEach((item) => {
        errArr.push(item.message)
      });
      let goodsListErrorFlag = false;
      let goodsListError = this.row?.goodsList || [];
      goodsListError.length && goodsListError?.forEach((item) => {
        if (item.errors.length) {
          goodsListErrorFlag = true
        }
      });
      if (goodsListErrorFlag) {
        errArr.push("订单物品信息异常")
      }
      return errArr.toString();
    }
  }
};
</script>
